package com.atguigu.day31.session04;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import java.io.IOException;

@WebServlet("/sessionC")
public class SessionServletC extends HttpServlet {

    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("SessionServletB 请求到达了");
        HttpSession session = req.getSession();
        //todo 设置最大不活跃间隔 秒
        //session.setMaxInactiveInterval(30);
        //session 失效
        session.invalidate();
        resp.getWriter().println("SessionServletC Success");

    }
}
